<ul id="menu">
    {assign var=isparent value=0}    
    {foreach from=$sections item=section}
    {if $section->parent == 0}

    {if $current->parents[0]!=""}
        {foreach from=$current->parents item=parent}
             {if $parent==$section->id}
                  {assign var=isparent value=1}                
             {/if}
        {/foreach}
    {/if}

    {if $section->active == 1 }
        {if $section->public == 1}
        <li  {if $section->id==$current->id || $isparent==1} {/if}><a href="{$section->link}"{if $section->new_window} target="_blank"{/if}>{$section->name}</a></li>
        {/if}
    {else}
        <li><span class="navlink">{$section->name}</span></li>
    {/if}
    {/if}
    {assign var=isparent value=0}
    {/foreach}
</ul>
